package au.org.ala.phylojive

import grails.test.mixin.TestFor

/**
 * See the API for {@link grails.test.mixin.services.ServiceUnitTestMixin} for usage instructions
 */
@TestFor(CharService)
class CharServiceTests {
    def charService

    void testSomething() {
        def charCvs = "\"scientificName\",\"seed mass\",\"Inflorescence colour\",\"plant height\",\"Phyllode length median\",\"Inflorescence arrangement\",\"Stipule length median\",\"Inflorescence shape\",\" leaflet pairs 2nd leaf\",\"range size\",\"genome size\",\"Phyllode arrangement\",\"Pulvinus length median\",\"first leaf pinnae pairs\",\"section taxonomy\"\n" +
                "\"Acacia diphylla\",\"5.4\",\"unknown\",\"\",\"\",\"unknown\",\"\",\"unknown\",\"1.9\",\"\",\"\",\"unknown\",\"\",\"2.0\",\"unknown\"\n" +
                "\"Acacia courtii\",\"true\",\"white to cream||pale yellow\",\"20\",\"115\",\"simple\",\"0.25\",\"cylindrical\",\"\",\"2\",\"\",\"scattered\",\"\",\"\",\"juliflorae\"\n" +
                "\"Acacia erinacea\",\"false\",\"lemon yellow to golden\",\"0.65\",\"8.5\",\"racemose\",\"\",\"globular\",\"\",\"169\",\"\",\"scattered\",\"\",\"\",\"phyllodineae\"\n" +
                "\"Acacia insolita subsp. insolita\",\"False\",\"white to cream||pale yellow||lemon yellow to golden\",\"0.75\",\"40\",\"racemose\",\"2.5\",\"globular\",\"\",\"29\",\"\",\"scattered\",\"\",\"\",\"phyllodineae\"\n" +
                "\"Acacia elachantha (glabrous variant)\",\"True\",\"lemon yellow to golden\",\"\",\"145\",\"racemose\",\"\",\"cylindrical\",\"\",\"\",\"\",\"scattered\",\"4.5\",\"\",\"juliflorae\"\n" +
                "\"Acacia oncinophylla subsp. oncinophylla\",\"\",\"lemon yellow to golden\",\"1.75\",\"105\",\"simple\",\"\",\"cylindrical\",\"\",\"19\",\"\",\"scattered\",\"\",\"\",\"juliflorae\"\n" +
                "\"Acacia hilliana\",\"9.2\",\"lemon yellow to golden\",\"1.5\",\"44\",\"simple\",\"\",\"cylindrical\",\"2.2\",\"235\",\"\",\"scattered||fasciculate\",\"\",\"3.0\",\"juliflorae\"\n" +
                "\"Acacia alpina\",\"TRUE\",\"white to cream||pale yellow\",\"1.5\",\"25\",\"simple\",\"0.75\",\"ellipsoid||cylindrical\",\"\",\"32\",\"\",\"scattered\",\"\",\"\",\"juliflorae\"\n" +
                "\"Acacia burrowii\",\"5.6\",\"lemon yellow to golden\",\"13\",\"67.5\",\"racemose\",\"\",\"cylindrical\",\"2.5\",\"91\",\"\",\"scattered\",\"\",\"2.0\",\"phyllodineae\""
        def jsonObj = charService.convertCharCsvToJson(charCvs, null)
        def jsonOutput = new groovy.json.JsonBuilder( jsonObj ).toString()
        log.info("JSON output: " + jsonOutput);
    }
}
